package org.luckyjourney.controller.navigationBar;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.luckyjourney.entity.booking.NavigationBar;
import org.luckyjourney.entity.booking.dto.NavigationBarDTO;
import org.luckyjourney.service.navigationBar.NavigationBarService;
import org.luckyjourney.util.PageResult;
import org.luckyjourney.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "底部导航栏")
@RequestMapping("/luckyjourney/NavigationBar")
@Slf4j
public class NavigationBarController {

    @Autowired
    NavigationBarService navigationBarService;

    @PostMapping("/insert")
    @ApiOperation("底部导航栏新增")
    // @RequiresPermissions("byt:insert")
    public Result insert(@RequestBody NavigationBar navigationBar) {
        log.info("底部导航栏新增");
        log.info("请求方式 Post");
        log.info("请求路径 /NavigationBar/insert");
        String insert = navigationBarService.insert(navigationBar);
        return Result.success(insert);
    }


    @PostMapping("/delect")
    @ApiOperation("底部导航栏删除")
//    @RequiresPermissions("byt:delect")
    public Result delect(@RequestBody NavigationBar navigationBar) {
        log.info("底部导航栏删除");
        log.info("请求方式 Post");
        log.info("请求路径 /byt/delect");
        Result result = navigationBarService.delect(navigationBar);
        return Result.success(result);
    }


    @PostMapping("/update")
    @ApiOperation("底部导航栏更新")
//    @RequiresPermissions("byt:update")
    public Result updates(@RequestBody NavigationBar navigationBar) {
        log.info("底部导航栏更新");
        log.info("请求方式 Post");
        log.info("请求路径 /byt/update");
        Result result = navigationBarService.updates(navigationBar);
        return Result.success(result);
    }

    @PostMapping("/selectId")
    @ApiOperation("底部导航栏回显")
    public Result selectId(@RequestBody NavigationBar navigationBar) {
        log.info("底部导航栏更新");
        log.info("请求方式 Post");
        log.info("请求路径 /byt/update");
        Result result = navigationBarService.selectId(navigationBar);
        return Result.success(result);
    }

    @PostMapping("/page")
    @ApiOperation("底部导航栏列表")
    // @RequiresPermissions("byt:select")
    public Result pageselect(@RequestBody NavigationBarDTO navigationBarDTO) {
        log.info("底部导航栏列表");
        log.info("请求方式 Post");
        log.info("请求路径 /byt/update");
        PageResult page = navigationBarService.selectPage(navigationBarDTO);
        return Result.success(page);
    }


}
